/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package riteservices.model.dao;

import java.util.ArrayList;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.FetchMode;
import org.hibernate.criterion.Restrictions;
import riteservices.model.bean.Fbfriends;
import riteservices.model.bean.Round;

/**
 *
 * @author sixviv
 */
public class FbFriendsDAO extends GeneralDAO<Fbfriends>{
    
    public List<Fbfriends> getFriends(int idUser){
        List<Fbfriends> result=new ArrayList<Fbfriends>();       
        session = HibernateUtil.getSessionFactory().openSession();
        Criteria criteria = session.createCriteria(Fbfriends.class);
        criteria.setFetchMode("userByUserIdUser", FetchMode.JOIN);
        criteria.setFetchMode("userByUserIdUserF", FetchMode.JOIN);
        criteria.add(Restrictions.eq("userByUserIdUser.idUser", idUser));
        result = criteria.list();
        session.close();       
        return result;
    }

}
